<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>netaddr.address.CIDR</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="netaddr-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >netaddr</th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="netaddr-module.html">Package&nbsp;netaddr</a> ::
        <a href="netaddr.address-module.html" onclick="show_private();">Module&nbsp;address</a> ::
        Class&nbsp;CIDR
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="netaddr.address.CIDR-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class CIDR</h1><p class="nomargin-top"><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR">source&nbsp;code</a></span></p>
<pre class="base-tree">
object --+    
         |    
   <a href="netaddr.address.IPRange-class.html">IPRange</a> --+
             |
            <strong class="uidshort">CIDR</strong>
</pre>

<hr />
<p>Represents blocks of IPv4 and IPv6 addresses using CIDR (Classless 
  Inter-Domain Routing) notation.</p>
  <p>CIDR is a method of categorising contiguous blocks of both IPv4 and 
  IPv6 addresses. It is very scalable allowing for the optimal usage of the
  IP address space. It permits the aggregation of networks via route 
  summarisation (supernetting) where adjacent routes can be combined into a
  single route easily. This greatly assists in the reduction of routing 
  table sizes and improves network router efficiency.</p>
  <p>CIDR blocks are represented by a base network address and a prefix 
  indicating the size of the (variable length) subnet mask. These are 
  separated by a single '/' character. Subnet sizes increase in powers of 
  base 2 aligning to bit boundaries.</p>
  <p>It is technically invalid to have non-zero bits in a CIDR address to 
  the right of the implied netmask. For user convenience this is however 
  configurable and can be disabled using a constructor argument.</p>
  <p>The constructor accepts CIDRs expressed in one of 4 different ways 
  :-</p>
  <p>A) Standard CIDR format :-</p>
  <p>IPv4:</p>
<pre class="literalblock">
   x.x.x.x/y -&gt; 192.0.2.0/24
</pre>
  <p>where the x's represent the network address and y is the netmask 
  prefix between 0 and 32.</p>
  <p>IPv6:</p>
<pre class="literalblock">
   x::/y -&gt; fe80::/10
</pre>
  <p>where the x's represent the network address and y is the netmask 
  prefix between 0 and 128.</p>
  <p>B) Abbreviated CIDR format (IPv4 only):</p>
<pre class="literalblock">
   x       -&gt; 192
   x/y     -&gt; 10/8
   x.x/y   -&gt; 192.168/16
   x.x.x/y -&gt; 192.168.0/24
</pre>
  <p>which are equivalent to:</p>
<pre class="literalblock">
   x.0.0.0/y   -&gt; 192.0.0.0/24
   x.0.0.0/y   -&gt; 10.0.0.0/8
   x.x.0.0/y   -&gt; 192.168.0.0/16
   x.x.x.0/y   -&gt; 192.168.0.0/24

   - The trailing zeros are implicit.
   - Old classful IP address rules apply if y is omitted.
</pre>
  <p>C) Hybrid CIDR format (prefix replaced by netmask) :-</p>
  <p>IPv4:</p>
<pre class="literalblock">
   x.x.x.x/y.y.y.y -&gt; 192.0.2.0/255.255.255.0
</pre>
  <p>IPv6:</p>
<pre class="literalblock">
   x::/y:: -&gt; fe80::/ffc0::
</pre>
  <p>where the y's represent a valid netmask.</p>
  <p>D) ACL-style CIDR format (prefix is replaced by a hostmask) :-</p>
  <p>Akin to Cisco's ACL (Access Control List) bitmasking (reverse 
  netmasks).</p>
  <p>IPv4:</p>
<pre class="literalblock">
   x.x.x.x/y.y.y.y -&gt; 192.0.2.0/0.0.0.255
</pre>
  <p>IPv6:</p>
<pre class="literalblock">
   x::/y:: -&gt; fe80::/3f:ffff:ffff:ffff:ffff:ffff:ffff:ffff
</pre>
  <p>where the y's represent a valid hostmask.</p>
  <p>Reference: RFCs 1338 and 4632.</p>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Instance Methods</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netaddr.address.CIDR-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">cidr</span>,
        <span class="summary-sig-arg">fmt</span>=<span class="summary-sig-default">&lt;class 'netaddr.address.IP'&gt;</span>,
        <span class="summary-sig-arg">strict</span>=<span class="summary-sig-default">True</span>)</span><br />
      Constructor.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netaddr.address.CIDR-class.html#__sub__" class="summary-sig-name">__sub__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">other</span>)</span><br />
      Subtract another CIDR from this one.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.__sub__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netaddr.address.CIDR-class.html#__add__" class="summary-sig-name">__add__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">other</span>)</span><br />
      Add another CIDR to this one returning a CIDR supernet that will 
      contain both in the smallest possible sized range.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.__add__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netaddr.address.CIDR-class.html#iter_host_addrs" class="summary-sig-name">iter_host_addrs</a>(<span class="summary-sig-arg">self</span>)</span><br />
      @return: An iterator object providing access to all valid host IP
    addresses within the specified CIDR block.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.iter_host_addrs">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netaddr.address.CIDR-class.html#subnet" class="summary-sig-name">subnet</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">prefixlen</span>,
        <span class="summary-sig-arg">count</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">fmt</span>=<span class="summary-sig-default">None</span>)</span><br />
      A generator that returns CIDR subnets based on the current network 
      base address and provided CIDR prefix and count.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.subnet">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netaddr.address.CIDR-class.html#cidrs" class="summary-sig-name">cidrs</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Returns:
      A list of a copy of this <a href="netaddr.address.CIDR-class.html" 
      class="link">CIDR</a> object.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.cidrs">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netaddr.address.CIDR-class.html#__str__" class="summary-sig-name">__str__</a>(<span class="summary-sig-arg">self</span>)</span><br />
      str(x)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.__str__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netaddr.address.CIDR-class.html#__repr__" class="summary-sig-name">__repr__</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Returns:
      executable Python string to recreate equivalent object.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.__repr__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="netaddr.address.IPRange-class.html">IPRange</a></code></b>:
      <code><a href="netaddr.address.IPRange-class.html#__contains__">__contains__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__eq__">__eq__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__ge__">__ge__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__getitem__">__getitem__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__gt__">__gt__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__hash__">__hash__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__iadd__">__iadd__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__isub__">__isub__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__iter__">__iter__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__le__">__le__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__len__">__len__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__lt__">__lt__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#__ne__">__ne__</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#adjacent">adjacent</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#format">format</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#iprange">iprange</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#issubnet">issubnet</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#issupernet">issupernet</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#overlaps">overlaps</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#size">size</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#wildcard">wildcard</a></code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__delattr__</code>,
      <code>__getattribute__</code>,
      <code>__new__</code>,
      <code>__reduce__</code>,
      <code>__reduce_ex__</code>,
      <code>__setattr__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== STATIC METHODS ==================== -->
<a name="section-StaticMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Static Methods</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netaddr.address.CIDR-class.html#abbrev_to_verbose" class="summary-sig-name">abbrev_to_verbose</a>(<span class="summary-sig-arg">abbrev_cidr</span>)</span><br />
      A static method that converts abbreviated IPv4 CIDRs to their more 
      verbose equivalent.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.abbrev_to_verbose">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netaddr.address.CIDR-class.html#span" class="summary-sig-name">span</a>(<span class="summary-sig-arg">addrs</span>,
        <span class="summary-sig-arg">fmt</span>=<span class="summary-sig-default">None</span>)</span><br />
      Static method that accepts a sequence of IP addresses and/or CIDRs, 
      Wildcards and IPRanges returning a single CIDR that is large enough 
      to span the lowest and highest IP addresses in the sequence (with a 
      possible overlap on either end).</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.span">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== CLASS VARIABLES ==================== -->
<a name="section-ClassVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Class Variables</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="STRATEGIES"></a><span class="summary-name">STRATEGIES</span> = <code title="ST_IPV4, ST_IPV6">ST_IPV4, ST_IPV6</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="ADDR_TYPES"></a><span class="summary-name">ADDR_TYPES</span> = <code title="AT_UNSPEC, AT_INET, AT_INET6">AT_UNSPEC, AT_INET, AT_INET6</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="strategy"></a><span class="summary-name">strategy</span> = <code title="StrategyDescriptor(STRATEGIES)">StrategyDescriptor(STRATEGIES)</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="addr_type"></a><span class="summary-name">addr_type</span> = <code title="AddrTypeDescriptor(ADDR_TYPES)">AddrTypeDescriptor(ADDR_TYPES)</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="prefixlen"></a><span class="summary-name">prefixlen</span> = <code title="PrefixLenDescriptor('CIDR')">PrefixLenDescriptor('CIDR')</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="fmt"></a><span class="summary-name">fmt</span> = <code title="FormatDescriptor(IP)">FormatDescriptor(IP)</code>
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="netaddr.address.IPRange-class.html">IPRange</a></code></b>:
      <code><a href="netaddr.address.IPRange-class.html#first">first</a></code>,
      <code><a href="netaddr.address.IPRange-class.html#last">last</a></code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Properties</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="netaddr.address.CIDR-class.html#network" class="summary-name">network</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="netaddr.address.CIDR-class.html#broadcast" class="summary-name">broadcast</a><br />
      <b>Please Note:</b> although IPv6 doesn't actually recognise the 
      concept of a 'broadcast' address as the last address in a subnet (as 
      in IPv4) so many other libraries do this that it isn't worth trying 
      to resist.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="netaddr.address.CIDR-class.html#netmask" class="summary-name">netmask</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="netaddr.address.CIDR-class.html#hostmask" class="summary-name">hostmask</a>
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__class__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Method Details</span></td>
</tr>
</table>
<a name="abbrev_to_verbose"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">abbrev_to_verbose</span>(<span class="sig-arg">abbrev_cidr</span>)</span>
    <br /><em class="fname">Static Method</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.abbrev_to_verbose">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>A static method that converts abbreviated IPv4 CIDRs to their more 
  verbose equivalent.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>abbrev_cidr</code></strong> - an abbreviated CIDR.
          <p>Uses the old-style classful IP address rules to decide on a 
          default subnet prefix if one is not explicitly provided.</p>
          <p>Only supports IPv4 addresses.</p>
          <p>Examples :</p>
<pre class="literalblock">
   10                  - 10.0.0.0/8
   10/16               - 10.0.0.0/16
   128                 - 128.0.0.0/16
   128/8               - 128.0.0.0/8
   192.168             - 192.168.0.0/16
</pre></li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>A verbose CIDR from an abbreviated CIDR or old-style classful 
          network address, <code>None</code> if format provided was not 
          recognised or supported.</dd>
  </dl>
</td></tr></table>
</div>
<a name="span"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">span</span>(<span class="sig-arg">addrs</span>,
        <span class="sig-arg">fmt</span>=<span class="sig-default">None</span>)</span>
    <br /><em class="fname">Static Method</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.span">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Static method that accepts a sequence of IP addresses and/or CIDRs, 
  Wildcards and IPRanges returning a single CIDR that is large enough to 
  span the lowest and highest IP addresses in the sequence (with a possible
  overlap on either end).</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>addrs</code></strong> - a sequence of IP, CIDR, Wildcard or IPRange objects and/or their 
          string representations.</li>
        <li><strong class="pname"><code>fmt</code></strong> - (optional) callable used on return values. (Default: None - <a 
          href="netaddr.address.CIDR-class.html" class="link">CIDR</a> 
          object) Also accepts str() and unicode().</li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>a single CIDR object spanning all addresses.</dd>
  </dl>
</td></tr></table>
</div>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">cidr</span>,
        <span class="sig-arg">fmt</span>=<span class="sig-default">&lt;class 'netaddr.address.IP'&gt;</span>,
        <span class="sig-arg">strict</span>=<span class="sig-default">True</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.__init__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Constructor.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>cidr</code></strong> - a valid IPv4/IPv6 CIDR address or abbreviated IPv4 network 
          address.</li>
        <li><strong class="pname"><code>fmt</code></strong> - (optional) callable used on return values. Default: <a 
          href="netaddr.address.IP-class.html" class="link">IP</a> class. 
          See <a href="netaddr.address-module.html#nrange" 
          class="link">nrange()</a> documentations for more details on the 
          various options.</li>
        <li><strong class="pname"><code>strict</code></strong> - (optional) performs a test to ensure there are no non-zero bits 
          to the right of the subnet mask or prefix when it is applied to 
          the base address. (default: True)</li>
    </ul></dd>
    <dt>Overrides:
        object.__init__
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__sub__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__sub__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">other</span>)</span>
    <br /><em class="fname">(Subtraction operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.__sub__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Subtract another CIDR from this one.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>other</code></strong> - a CIDR object that is greater than or equal to <code>self</code>.</li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>A list of CIDR objects than remain after subtracting 
          <code>other</code> from <code>self</code>.</dd>
  </dl>
</td></tr></table>
</div>
<a name="__add__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__add__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">other</span>)</span>
    <br /><em class="fname">(Addition operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.__add__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Add another CIDR to this one returning a CIDR supernet that will 
  contain both in the smallest possible sized range.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>other</code></strong> - a CIDR object.</li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>A new (potentially larger) CIDR object.</dd>
  </dl>
</td></tr></table>
</div>
<a name="iter_host_addrs"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">iter_host_addrs</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.iter_host_addrs">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

@return: An iterator object providing access to all valid host IP
    addresses within the specified CIDR block.
    - with IPv4 the network and broadcast addresses are always
    excluded. Any smaller than 4 hosts yields an emtpy list.
    - with IPv6 only the unspecified address '::' is excluded from
    the yielded list.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="subnet"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">subnet</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">prefixlen</span>,
        <span class="sig-arg">count</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">fmt</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.subnet">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>A generator that returns CIDR subnets based on the current network 
  base address and provided CIDR prefix and count.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>prefixlen</code></strong> - a CIDR prefix.</li>
        <li><strong class="pname"><code>count</code></strong> - number of consecutive CIDRs to be returned.</li>
        <li><strong class="pname"><code>fmt</code></strong> - callable used on return values. Default: None - <a 
          href="netaddr.address.CIDR-class.html" class="link">CIDR</a> 
          objects. str() and unicode() supported.</li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>an iterator (as lists could potentially be very large) containing
          CIDR subnets below this CIDR's base address.</dd>
  </dl>
</td></tr></table>
</div>
<a name="cidrs"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">cidrs</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.cidrs">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Returns:</dt>
        <dd>A list of a copy of this <a 
          href="netaddr.address.CIDR-class.html" class="link">CIDR</a> 
          object. This method is here mainly for compatibility with IPRange
          interface.</dd>
    <dt>Overrides:
        <a href="netaddr.address.IPRange-class.html#cidrs">IPRange.cidrs</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__str__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__str__</span>(<span class="sig-arg">self</span>)</span>
    <br /><em class="fname">(Informal representation operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.__str__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>str(x)</p>
  <dl class="fields">
    <dt>Overrides:
        object.__str__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__repr__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__repr__</span>(<span class="sig-arg">self</span>)</span>
    <br /><em class="fname">(Representation operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="netaddr.address-pysrc.html#CIDR.__repr__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>repr(x)</p>
  <dl class="fields">
    <dt>Returns:</dt>
        <dd>executable Python string to recreate equivalent object.</dd>
    <dt>Overrides:
        object.__repr__
    </dt>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== PROPERTY DETAILS ==================== -->
<a name="section-PropertyDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Property Details</span></td>
</tr>
</table>
<a name="network"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">network</h3>
  
  <dl class="fields">
    <dt>Get Method:</dt>
    <dd class="value"><span class="summary-sig"><i>unreachable</i>.network(<span class="summary-sig-arg">self</span>)</span>
        - Returns:
The network (first) address in this CIDR block.
    </dd>
  </dl>
</td></tr></table>
</div>
<a name="broadcast"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">broadcast</h3>
  <p><b>Please Note:</b> although IPv6 doesn't actually recognise the 
  concept of a 'broadcast' address as the last address in a subnet (as in 
  IPv4) so many other libraries do this that it isn't worth trying to 
  resist. This issue raises so many user queries that it is easier to 
  dispense with the theory and be pragmatic instead.</p>
  <dl class="fields">
    <dt>Get Method:</dt>
    <dd class="value"><span class="summary-sig"><i>unreachable</i>.broadcast(<span class="summary-sig-arg">self</span>)</span>
        - <b>Please Note:</b> although IPv6 doesn't actually recognise the concept of
a 'broadcast' address as the last address in a subnet (as in IPv4) so many 
other libraries do this that it isn't worth trying to resist.
    </dd>
  </dl>
</td></tr></table>
</div>
<a name="netmask"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">netmask</h3>
  
  <dl class="fields">
    <dt>Get Method:</dt>
    <dd class="value"><span class="summary-sig"><i>unreachable</i>.netmask(<span class="summary-sig-arg">self</span>)</span>
        - Returns:
The subnet mask address of this CIDR block.
    </dd>
  </dl>
</td></tr></table>
</div>
<a name="hostmask"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">hostmask</h3>
  
  <dl class="fields">
    <dt>Get Method:</dt>
    <dd class="value"><span class="summary-sig"><i>unreachable</i>.hostmask(<span class="summary-sig-arg">self</span>)</span>
        - Returns:
The host mask address of this CIDR block.
    </dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="netaddr-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >netaddr</th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Wed Jan 21 23:41:06 2009
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
